<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const data = [{
        id:1,
        name:'Huawei Mate50 pro',
        price:6998
    },{
        id:2,
        name:'Apple 18',
        price:12998
    },{
        id:3,
        name:'xiaomi 12',
        price:3998
    }]           
    // 方法1
    const data1 = JSON.stringify(data);
    const data2 = JSON.parse(data1);
    console.log(data2);
    // 方法2
    const data3 = data.slice(0)
    console.log(data3);
    </script>
</body>
</html>